Fix: Use gas limit estimate by default#787
Open
renatomaia wants to merge 3 commits into
Open
Conversation
mpolitzer
previously approved these changes
Jun 30, 2026
There was a problem hiding this comment.
Pull request overview
This PR updates transaction submission across the CLI/ethutil paths to stop forcing a fixed 30M gas limit and instead default to go-ethereum gas estimation (GasLimit = 0), while introducing an optional CARTESI_BLOCKCHAIN_GAS_LIMIT override that can be set via config/env or a hidden --gas-limit flag.
Changes:
- Removed the hardcoded gas limit plumbing (
GasLimit = 30_000_000) so contract bindings can estimate gas by default. - Added
CARTESI_BLOCKCHAIN_GAS_LIMITto the generated configuration surface and applied it inauth.GetTransactOptswhen non-zero. - Added tests ensuring gas limit propagation in
auth.GetTransactOpts, and adjusted self-hosted deployment error wrapping.
Reviewed changes
Copilot reviewed 7 out of 8 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| pkg/ethutil/transaction.go | Stops forcing a gas limit into TransactOpts, enabling default estimation. |
| pkg/ethutil/selfhosted.go | Updates deployment transaction call path; adjusts error wrapping on failure. |
| pkg/ethutil/ethutil.go | Removes usage of the deleted fixed gas limit constant across CLI write paths. |
| internal/config/generated.go | Adds CARTESI_BLOCKCHAIN_GAS_LIMIT constant/default, structs, loaders, and getter. |
| internal/config/generate/Config.toml | Declares the new CARTESI_BLOCKCHAIN_GAS_LIMIT config entry for generation. |
| internal/config/auth/auth.go | Applies the configured gas limit override to returned TransactOpts. |
| internal/config/auth/auth_test.go | Adds coverage for default (0) vs configured gas limit behavior. |
| cmd/cartesi-rollups-cli/root/root.go | Adds hidden --gas-limit flag bound to CARTESI_BLOCKCHAIN_GAS_LIMIT. |
Files not reviewed (1)
- internal/config/generated.go: Generated file
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
ce20221 to
a976a93
Compare
a976a93 to
bfbc92b
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR changes CLI transaction submission to use the gas limit estimated by the Ethereum client by default instead of forcing a fixed
30_000_000gas limit.It also adds
CARTESI_BLOCKCHAIN_GAS_LIMITas an optional configuration value for deployments that still need to override the gas limit manually. The default is0, which leavesbind.TransactOpts.GasLimitunset and allows go-ethereum contract bindings to estimate gas.Changes
Remove the hardcoded
ethutil.GasLimitfrom CLI transaction paths.Add
CARTESI_BLOCKCHAIN_GAS_LIMITconfig support across node, claimer, evmreader, and prt config.Apply a non-zero configured gas limit in
auth.GetTransactOpts.Add a hidden
--gas-limitCLI flag bound toCARTESI_BLOCKCHAIN_GAS_LIMIT.Preserve the original transaction error cause when self-hosted application deployment fails.
Add focused tests for gas limit propagation in
auth.GetTransactOpts.Testing
Added coverage for:
0leavingtxOpts.GasLimitunsetCARTESI_BLOCKCHAIN_GAS_LIMITsettingtxOpts.GasLimitFixes: #786